import { defineStore } from 'pinia';
import { reactive } from 'vue';
export interface IUser {
  realName?: string
  roleEn?: string
  roleCh?: string
  department?: string
  userId?: string
  version?: string
}
export const useUserStore = defineStore('user', () => {
  const user = reactive({
    realName: "",
    roleEn: "",
    roleCh: "",
    department: "",
    userId: "",
		version: "",
  })

  const updateUser = (params: IUser) => {
    params.realName && (user.realName = params.realName)
    params.roleEn && (user.roleEn = params.roleEn)
    params.roleCh && (user.roleCh = params.roleCh)
    params.department && (user.department = params.department)
    params.userId && (user.userId = params.userId)
    params.version && (user.version = params.version)
  }
  return {
    user,
    updateUser
  }
});
